import request from '@/utils/request'

/**
 * 查询企业的部门列表
 * @returns
 */
export function getDepartmentList() {
  return request({
    url: '/company/department'
  })
}

/**
 * 根据ID删除部门
 * @param {*} id
 * @returns
 */
export function delDepartment(id) {
  return request({
    url: '/company/department/' + id,
    method: 'DELETE'
  })
}

/**
 * 新增部门
 * @param data
 * @returns {AxiosPromise}
 */
export function addDepartment(data) {
  return request({
    url: '/company/department',
    method: 'POST',
    data
  })
}

/**
 * 根据ID查询部门详情
 * @param id
 * @returns {AxiosPromise}
 */
export function getDepartmentById(id) {
  return request({
    url: '/company/department/' + id
  })
}

/**
 * 根据ID修改部门详情
 * @param data
 * @returns {AxiosPromise}
 */
export function editDepartment(data) {
  return request({
    url: '/company/department/' + data.id,
    method: 'PUT',
    data
  })
}
